/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package itcast;

/**
 * <p>Project: JavaStudy - Opt4
 * <p>Powered by jiangbo On 2023-01-31
 * 16:00:49
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class Opt4 {
    public static void main(String[] args) {
//逻辑运算 与 && & 或 || | 非 ! 异或 ^
//true && 支持短路效率高 & 不支持短路效率低
        System.out.println(true && true);
        System.out.println(true & true);
//false
        System.out.println(true && false);
        System.out.println(true & false);
        System.out.println(false && true);
        System.out.println(false & true);
        System.out.println(false && false);
        System.out.println(false & false);
        System.out.println("-".repeat(30));
        int a = 1;
        int b = 2;
//&&支持短路 false 1 2
boolean f = a==2 && ++b == 2;
//&不支持短路 false 1 3
        //boolean f = a==2 & ++b == 2;
        System.out.println(f);
        System.out.println(a);
        System.out.println(b);
        System.out.println("*".repeat(35));
//|| 逻辑或 |
        System.out.println(true||true);
        System.out.println(true||false);
        System.out.println(false||true);
        System.out.println(false||false);
        System.out.println("*".repeat(35));
//^ 逻辑异或
        System.out.println(true^true);
        System.out.println(true^false);
        System.out.println(false^true);
        System.out.println(false^false);
//逻辑非 ！
        System.out.println("*".repeat(35));
        System.out.println(!!false && !(3==2));
        System.out.println(!false && !(3==2));
        System.out.println(true && true);
    }

}


